package com.weiqiao.mall.rest;


import com.weiqiao.aop.log.Log;
import com.weiqiao.mall.domain.PageDecorationEntity;
import com.weiqiao.mall.service.IPageDecorationService;
import com.weiqiao.mall.service.vo.PageDecorationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 页面配置控制层
 *
 * @author
 */
@RestController
@RequestMapping("/api")
public class PageDecorationController {

    @Autowired
    private IPageDecorationService pageDecorationService;

    @Log("移动端页面列表")
    @GetMapping("/get-page-list")
    public ResponseEntity getPageList(PageDecorationVO pageDecorationVO) {
        return new ResponseEntity(pageDecorationService.getPageList(pageDecorationVO), HttpStatus.OK);
    }

    @Log("移动端页面删除")
    @PostMapping("/del-page")
    public ResponseEntity delPageById(@RequestBody PageDecorationVO pageDecorationVO) {
        return new ResponseEntity(pageDecorationService.deletePage(pageDecorationVO), HttpStatus.OK);
    }

    @Log("移动端页面新增、修改")
    @PostMapping("/update-page")
    public ResponseEntity updatePage(@RequestBody PageDecorationEntity pageDecorationEntity) {
        return new ResponseEntity(pageDecorationService.updatePage(pageDecorationEntity), HttpStatus.OK);
    }

}
